import os
from multiprocessing import Process


def run_proc(name):
    """
    子进程的执行方法
    :param name:
    :return:
    """
    print("Run child process {}({})".format(name, os.getpid()))
    print("Child process run end")



if __name__ == "__main__":
    print("Parent process's id is {}".format(os.getpid()))
    # 创建一个子进程，元组中只包含一个元素时，需要在元素后面添加逗号
    process = Process(target=run_proc, args=("子进程",))
    process.start()  # 启动
    process.join()  # 等待进程完成
    print("Child run end")
